<script setup lang="ts">
// import navibar from './components/common/navibar.vue';
import { provide, ref, watch } from 'vue';
import { useRouter, useRoute } from 'vue-router'
const showButton = ref(true);
const showNavbar = ref(true);
const refTitle = ref("")
refTitle.value = document.title;
const router = useRouter();
let route = useRoute();
provide("showButton", showButton);
provide("showNavbar", showNavbar);
//provide("refTitle",refTitle);
const onClickLeft = () => router.go(-1);
const onClickRight = () => router.push("/");
watch(route, (newValue) => {
  refTitle.value = newValue.meta.title as string;
});
</script>

<template>
  <van-nav-bar v-if="showNavbar" left-text="返回" right-text="主页" :title="refTitle" left-arrow @click-left="onClickLeft"
    @click-right="onClickRight" />
  <router-view />
  <!-- <navibar v-if="showButton" /> -->
</template>

<style scoped>
body {
  margin: 0;
  position: relative;
  display: flex;
  overflow: hidden;
  place-items: center;
  background-color: #fff;

  -webkit-touch-callout: none;
  pointer-events: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#app {
  text-align: center;
  height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow: hidden;
}
</style>
